package com.ruoyi.omp.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.omp.api.RemoteActMaintainOrderService;
import com.ruoyi.omp.api.domain.ActMaintainOrderData;
import com.ruoyi.omp.api.domain.ScheduleTask;
import com.ruoyi.omp.api.domain.vo.ActMaintainOrderDataVO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class RemoteActMaintainOrderFactory implements FallbackFactory<RemoteActMaintainOrderService> {
    @Override
    public RemoteActMaintainOrderService create(Throwable throwable) {
        log.error("表单数据服务调用失败:{}", throwable.getMessage());
        return new RemoteActMaintainOrderService() {
            @Override
            public R addData(ActMaintainOrderData actMaintainOrderData) {
                
                return R.fail("添加表单数据失败:" + throwable.getMessage());
            }

            @Override
            public R editData(ActMaintainOrderData actMaintainOrderData) {
                return R.fail("更新表单数据失败:" + throwable.getMessage());
            }

            @Override
            public R<Integer> remoteSaveFormData(ActMaintainOrderDataVO actMaintainOrderDataVO) {
               return R.fail("保存表单数据失败:" + throwable.getMessage());
            }

            @Override
            public R getData(ActMaintainOrderData actMaintainOrderData) {
                return R.fail("查询表单数据失败:" + throwable.getMessage());
            }

            @Override
            public R addScheduleTask(ScheduleTask scheduleTask) {
                return R.fail("添加调度任务失败:" + throwable.getMessage());
            }
        };
    }
}
